package cn.edu.scau.cmi.liujiaming.chapter04;

public class Exercise4_7 {
	public static void main(String args[]) {
		int n=1,sum=0,temp=1;
		while(sum<=9876) {
			sum+=temp;
			temp*=(++n);
		}
		n=n-2;
		System.out.print(n);
	}
}